cmake_minimum_required(VERSION 3.0.0)
project(freecraft VERSION 0.1.0 LANGUAGES CXX)

# 静态链接需要定义
add_definitions(
    -DGLEW_STATIC
    -DFREEGLUT_STATIC
    # VS的定义
    -D_CRT_SECURE_NO_WARNINGS
)

file(GLOB freecraft_SRC
    *.cpp
    *.c
    shader/*.cpp
    core/*.hpp
    core/*.cpp
    )

add_executable(freecraft 
    ${freecraft_SRC}
)

target_link_libraries(freecraft 
    ${ALL_LIBS}
)

add_custom_command(TARGET freecraft
    PRE_BUILD
    COMMAND echo "Copy shader files"
    COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/shader ${CMAKE_CURRENT_BINARY_DIR}/shader
    COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/resource ${CMAKE_CURRENT_BINARY_DIR}/resource
    COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/objects ${CMAKE_CURRENT_BINARY_DIR}/objects
)
